<!DOCTYPE html>
<html>

<head>
	<title>WEB ACTIVITY MANAGER - Registrazione nuovo progetto</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<script type="text/javascript">
		
		function isRePasswordCorrect(){
			
			var password = document.getElementById("password").value;
			var re_password = document.getElementById("re_password").value;
			
			if(password!=re_password){
				alert("Le password devono coincidere!");
				document.getElementById("password").value = null;
				document.getElementById("re_password").value = null;
			}
		}
		
		function isPasswordCorrect(){
			
			var password = document.getElementById("password").value;
			var re_password = document.getElementById("re_password").value;
			
			if(re_password!=""){
				if(password!=re_password){
				alert("Le password devono coincidere!");
				document.getElementById("re_password").value = null;
				}
			}
		}
		
	</script>	
			
</head>
<body>

	<form name="registrazione" action="http://localhost:4444/registrazione">
		<fieldset>
				<legend> Registrazione di un nuovo progetto</legend>
				<table>
					<tr>
						<td><label for="username"> Username del Project Manager </label> </td>
							<td><input type="text" name="username" required id="username"/></td>
						</td>
					</tr>
					<tr>
						<td><label for="password"> Scegli una Password </label> </td>
							<td><input type="password" name="password" required id="password" onChange="isPasswordCorrect()"/></td>
						</td>
					</tr>
					<tr>
						<td><label for="re_password"> Inserisci nuovamente la Password </label> </td>
							<td><input type="password" required id="re_password" onChange="isRePasswordCorrect()"/></td>
						</td>
					</tr>
					<tr>
						<td><label for="nomeprogetto"> Nome progetto </label> </td>
							<td><input type="text" name="nomeprogetto" required id="nomeprogetto"/></td>
						</td>
					</tr>
					<tr>
						<td><label for="descprogetto"> Descrizione progetto </label> </td>
							<td><input type="textarea" name="descprogetto" id="descprogetto"/></td>
						</td>
					</tr>
				</table>
				<input type="submit" id="registra" value="Registra il progetto"/>
				<a href="http://localhost:4444/home.html">
					<input type="button" id="torna_home" value="Torna alla Home"/>
				</a>
		</fieldset>
	</form>

</body>
</html>
